package com.chenfan.mcn.enums;

/**
 * @Author liuyang
 * @Date 2021/6/8
 * @Time 10:28
 * @Version V1.0
 **/
@SuppressWarnings("AlibabaEnumConstantsMustHaveComment")
public enum BusinessCommissionEnum {

    /**
     * 商务提成枚举
     */

    NEWLY_BUILD(1, "新建"),

    // HAS_BEEN_SEND(2, "已发送"),

    // CONFIRMED(3, "已确认"),

    ISSUED(4, "已发放"),

    INVALID(9, "已作废");

    private final int code;
    private final String statusName;

    BusinessCommissionEnum(int code, String statusName) {
        this.code = code;
        this.statusName = statusName;
    }

    public int code() {
        return this.code;
    }

    public static BusinessCommissionEnum toEnum(int code) {
        for (BusinessCommissionEnum item : BusinessCommissionEnum.values()) {
            if (item.code == code) {
                return item;
            }
        }
        return null;
    }

    public static String getStatusName(int code) {
        BusinessCommissionEnum item = toEnum(code);
        return item != null ? item.statusName : null;
    }

    public static boolean issued(Integer code) {
        return code != null && BusinessCommissionEnum.ISSUED.code == code.intValue();
    }
}
